package top.tenebrous.yzl.tree;

import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author yazhang6
 */
public class Main {

    public static void main(String[] args) {
        List<TeacherDO> teachers = new ArrayList<>();
        buildList(teachers);
        System.out.println("----------------------------------");
        TreeBuilder<TeacherVO, TeacherDO> treeBuilder = new TreeBuilder<>(teachers);
        AbstractTreeBuilder.Builder<TeacherDO> builder = treeBuilder.newBuilder();


    }

    private static void buildList(List<TeacherDO> teachers) {
        // 第一层
        List<TeacherDO> level1 = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            TeacherDO teacher = new TeacherDO();
            teacher.setName("老师:" + i + ":1");
            teacher.setLevel("1");
            teacher.setParentId("0");
            teacher.setId(UUID.randomUUID().toString());
            level1.add(teacher);
        }
        // 第二层
        List<TeacherDO> level2 = new ArrayList<>();
        for (TeacherDO teacher : level1) {
            for (int i = 1; i <= 5; i++) {
                TeacherDO teacher1 = new TeacherDO();
                teacher1.setName("老师:" + i + ":2");
                teacher1.setLevel("2");
                teacher1.setParentId(teacher.getId());
                teacher1.setId(UUID.randomUUID().toString());
                level2.add(teacher1);
            }
        }

        // 第三层
        List<TeacherDO> level3 = new ArrayList<>();
        for (TeacherDO teacher : level1) {
            for (int i = 1; i <= 5; i++) {
                TeacherDO teacher1 = new TeacherDO();
                teacher1.setName("老师:" + i + ":3");
                teacher1.setLevel("3");
                teacher1.setParentId(teacher.getId());
                teacher1.setId(UUID.randomUUID().toString());
                level3.add(teacher1);
            }
        }
        teachers.addAll(level1);
        teachers.addAll(level2);
        teachers.addAll(level3);
    }


}

@Data
class TeacherVO extends BaseTree<TeacherVO, String> {

    private String name;

    private String level;

}

@Data
class TeacherDO {

    private String name;

    private String level;

    private String parentId;

    private String id;

}